package top.auntie.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.auntie.bean.OrgTypeReportQueryDto;
import top.auntie.bean.PageReq;
import top.auntie.bean.Result;
import top.auntie.model.OrgTypeReport;
import top.auntie.service.OrgTypeReportService;

@RestController
@RequestMapping("/org/type/report")
public class OrgTypeReportController {

    @Autowired
    private OrgTypeReportService orgTypeReportService;

    @GetMapping("/query")
    public Result queryOrgTypeReport(OrgTypeReportQueryDto dto) {
        return Result.success(orgTypeReportService.queryOrgTypeReport(dto));
    }

    @GetMapping("/query/date")
    public Result queryOrgTypeReportByDate(OrgTypeReportQueryDto dto) {
        return Result.success(orgTypeReportService.queryReportByDate(dto));
    }

    @GetMapping("/query/org")
    public Result queryOrgTypeReportByOrg(OrgTypeReportQueryDto dto) {
        return Result.success(orgTypeReportService.queryOrgTypeReportByOrg(dto));
    }

    @PostMapping("/save")
    public Result saveOrgTypeReport(@RequestBody OrgTypeReport orgTypeReport) {
        orgTypeReportService.saveOrgTypeReport(orgTypeReport);
        return Result.success();
    }

    @GetMapping("/find/reports")
    public Result queryReportByDateAndOrgId(@RequestParam("date") String date, @RequestParam("orgId") String orgId) {
        return Result.success(orgTypeReportService.queryReportByDateAndOrgId(date, orgId));
    }

}
